<script>

    var pageKM =<?php echo $this->numPageKM; ?>;
    var pageKhac =<?php echo $this->numPageKhac; ?>;
    var pageBC =<?php echo $this->numPageBC; ?>;
    var numKM = 1;
    var numKhac = 1;
    var numBC = 1;
    function get4NextKM() {

        numKM = numKM + 1;
        if (numKM > pageKM)
            numKM = 1;

        $.ajax({
            type: "get",
            url: "index/ajax4khuyenmai/page/" + numKM,
            success: function(response) {
                $(".km").html("");
                $(".km").html(response);
            },
            error: function() {
                alert('Error while request..');
            }
        });
    }
    function get4RevKM() {

        numKM = numKM - 1;
        if (numKM < 1)
            numKM = pageKM;

        $.ajax({
            type: "get",
            url: "index/ajax4khuyenmai/page/" + numKM,
            success: function(response) {
                $(".km").html("");
                $(".km").html(response);
            },
            error: function() {
                alert('Error while request..');
            }
        });
    }
    function get4NextKhac() {

        numKhac = numKhac + 1;
        if (numKhac > pageKhac)
            numKhac = 1;

        $.ajax({
            type: "get",
            url: "index/ajax4khac/page/" + numKhac,
            success: function(response) {
                $(".khac").html("");
                $(".khac").html(response);
            },
            error: function() {
                alert('Error while request..');
            }
        });
    }
    function get4RevKhac() {

        numKhac = numKhac - 1;
        if (numKhac < 1)
            numKhac = pageKhac;

        $.ajax({
            type: "get",
            url: "index/ajax4khac/page/" + numKhac,
            success: function(response) {
                $(".khac").html("");
                $(".khac").html(response);
            },
            error: function() {
                alert('Error while request..');
            }
        });
    }
     function get4NextBC() {

        numBC = numBC + 1;
        if (numBC > pageBC)
            numBC = 1;

        $.ajax({
            type: "get",
            url: "index/ajax4banchay/page/" + numBC,
            success: function(response) {
                $(".bc").html("");
                $(".bc").html(response);
            },
            error: function() {
                alert('Error while request..');
            }
        });
    }
    function get4RevBC() {

        numBC = numBC - 1;
        if (numBC < 1)
            numBC = pageBC;

        $.ajax({
            type: "get",
            url: "index/ajax4banchay/page/" + numBC,
            success: function(response) {
                $(".bc").html("");
                $(".bc").html(response);
            },
            error: function() {
                alert('Error while request..');
            }
        });
    }
</script>

<!--Khuyen mai giam gia -->
<div class="p-module">
    <div class="p-module-header p-module-header-blue clearfix">
        <h3>
            <a href="#" style="float: left; text-decoration: none;">
                Khuyến Mãi:
                <span style="color:red;"><?php echo $rowtl1[1]; ?> Giảm Giá</span>
            </a>
        </h3>
        <a class="tool-link" href="#">Xem tất cả</a>
    </div>


    <div class="p-module-body">
        <div class="p-product-list-1 products-slider">
            <input type="hidden" class="page_size" name="page_size" value="4"/>
            <div class="products-slider-viewport"><div class="products-slider-inner" style="position: relative; width: 750px; height: 253px; overflow: hidden; ">
                    <div class="products-page km" style="position: absolute; top: 0px; left: 0px; display: block; z-index: 5; opacity: 1; ">

                        <?php foreach ($this->khuyenmai as $sach) { ?>

                            <div class="product-one">   
                                <div class="p-thumb" >
                                    <a href="#" title="">
                                        <img class="" src="<?php echo HOST_PATH ?>public/images/sell/<?php echo $sach['anhbia'] ?>" width="109" height="160" alt="<?php echo $sach['tensach'] ?>" border="0"/>
                                    </a>
                                </div>      
                                <div>
                                    <h2>
                                        <a href="#" title="<?php echo $sach['tensach'] ?>"><?php echo $sach['tensach'] ?></a>
                                    </h2>

                                    <div class="p-price"><span><span id="sec_sell_price_69726"><?php echo $sach['giabia'] ?></span>&nbsp;VNĐ</span>
                                    </div>

                                    <div class="p-discount-percent">(Giảm <?php echo $sach['giamgia'] ?> %)</div>
                                </div>
                            </div>

                        <?php } ?>

                    </div>
                </div>
            </div>
            <a class="btn-prev kmprev" onclick="get4RevKM();" >undefined</a>
            <a class="btn-next kmnext" onclick="get4NextKM();">undefined</a>
        </div>
        <div class="cleardiv">
        </div>
    </div>
</div>
<!--Sach khac -->
<div class="p-module">

    <div class="p-module-header p-module-header-blue clearfix">
        <h3>
            <a href="xemtatca.php?id=2&page=1" style="float: left; text-decoration: none;">
                Sách Phương Nam Book
            </a>
        </h3>
        <a class="tool-link" href="xemtatca.php?id=2&page=1">Xem tất cả</a>
    </div>


    <div class="p-module-body">
        <div class="p-product-list-1 products-slider">
            <input type="hidden" class="page_size" name="page_size" value="4"/>
            <div class="products-slider-viewport"><div class="products-slider-inner" style="position: relative; width: 750px; height: 253px; overflow: hidden; ">
                    <div class="products-page khac" style="position: absolute; top: 0px; left: 0px; display: block; z-index: 5; opacity: 1; ">

                        <?php foreach ($this->khac as $sach) { ?>

                            <div class="product-one">   
                                <div class="p-thumb" >
                                    <a href="#" title="">
                                        <img class="" src="<?php echo HOST_PATH ?>public/images/sell/<?php echo $sach['anhbia'] ?>" width="109" height="160" alt="<?php echo $sach['tensach'] ?>" border="0"/>
                                    </a>
                                </div>      
                                <div>
                                    <h2>
                                        <a href="#" title="<?php echo $sach['tensach'] ?>"><?php echo $sach['tensach'] ?></a>
                                    </h2>

                                    <div class="p-price"><span><span id="sec_sell_price_69726"><?php echo $sach['giabia'] ?></span>&nbsp;VNĐ</span>
                                    </div>

                                </div>
                            </div>

                        <?php } ?>

                    </div>
                </div>
            </div>
            <a class="btn-prev kmprev" onclick="get4RevKhac();"  >undefined</a>
            <a class="btn-next kmnext" onclick="get4NextKhac();" >undefined</a>
        </div>
        <div class="cleardiv">
        </div>
    </div>
</div>

<!--Ban chay -->
<div class="p-module">

    <div class="p-module-header p-module-header-blue clearfix">
        <h3>
            <a href="xemtatca.php?id=3&page=1" style="float: left; text-decoration: none;">
                Sách Phương Nam Book Bán Chạy
            </a>
        </h3>
        <a class="tool-link" href="xemtatca.php?id=3&page=1">Xem tất cả</a>
    </div>


    <div class="p-module-body">
        <div class="p-product-list-1 products-slider">
            <input type="hidden" class="page_size" name="page_size" value="4"/>
            <div class="products-slider-viewport"><div class="products-slider-inner" style="position: relative; width: 750px; height: 253px; overflow: hidden; ">
                    <div class="products-page bc" style="position: absolute; top: 0px; left: 0px; display: block; z-index: 5; opacity: 1; ">

                        <?php foreach ($this->banchay as $sach) { ?>

                            <div class="product-one">   
                                <div class="p-thumb" >
                                    <a href="#" title="">
                                        <img class="" src="<?php echo HOST_PATH ?>public/images/sell/<?php echo $sach['anhbia'] ?>" width="109" height="160" alt="<?php echo $sach['tensach'] ?>" border="0"/>
                                    </a>
                                </div>      
                                <div>
                                    <h2>
                                        <a href="#" title="<?php echo $sach['tensach'] ?>"><?php echo $sach['tensach'] ?></a>
                                    </h2>

                                    <div class="p-price"><span><span id="sec_sell_price_69726"><?php echo $sach['giabia'] ?></span>&nbsp;VNĐ</span>
                                    </div>
                                    <?php if ($sach['giamgia'] > 0) { ?>
                                        <div class="p-discount-percent">(Giảm <?php echo $sach['giamgia'] ?> %)</div>
                                    <?php } ?>
                                </div>
                            </div>

                        <?php } ?>

                    </div>
                </div>
            </div>
            <a class="btn-prev kmprev"  >undefined</a>
            <a class="btn-next kmnext" >undefined</a>
        </div>
        <div class="cleardiv">
        </div>
    </div>
</div>